package _30define;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Review {
    String comment() default "Please review this method";
}

class AnnotationTest{
    public  void  method1(){
        System.out.println("method 1");
    }
    @Review
    public void method2(){
        System.out.println("method 2");
    }
    @Review
    public void method3(){
        System.out.println("method 3");
    }

    public static void main(String[] args) throws Exception {
        Class<?> c=Class.forName("_30define.AnnotationTest");
        Method[] de=c.getDeclaredMethods();
        for (Method method : de) {
            if (method.isAnnotationPresent(Review.class)){
                Review annotation=method.getAnnotation(Review.class);
                String msg=annotation.comment();
                System.out.println(method.getName()+msg);
            }
        }
    }
}
